//
//  VipAddrSearchAssociateController.m
//  CenturyCity
//
//  Created by nsm on 2019/6/13.
//  Copyright © 2019 beisheng. All rights reserved.
//

#import "VipAddrSearchAssociateController.h"

@interface VipAddrSearchAssociateCell : NSMTableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *subtitleLabel;
@end

@implementation VipAddrSearchAssociateCell
- (void)setObject:(id)obj {
    _titleLabel.attributedText = AttributedText(obj[@"title"],
                                                obj[@"words"]);
    _subtitleLabel.attributedText = AttributedText(obj[@"address"],
                                                   obj[@"words"]);
}

- (void)setupSubviews {
    MyLinearLayout *layout = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
    layout.backgroundColor = UIColor.whiteColor;
    layout.myHorzMargin = 0;
    layout.cacheEstimatedRect = YES;
    layout.padding = UIEdgeInsetsMake(15, 15, 15, 15);
    layout.subviewVSpace = 4;
    layout.gravity = MyGravity_Horz_Fill;
    [self.contentView addSubview:layout];
    self.rootLayout = layout;
    {
        UILabel *label = [UILabel new];
        label.wrapContentHeight = YES;
        [layout addSubview:label];
        _titleLabel = label;
    }
    {
        UILabel *label = [UILabel new];
        label.wrapContentHeight = YES;
        [layout addSubview:label];
        _subtitleLabel = label;
    }
}
@end

@implementation VipAddrSearchAssociateController
- (void)viewDidLoad {
    [super viewDidLoad];
        
    self.tableView.sourceManager.classForCellAtIndexPath = ^Class(NSIndexPath *indexPath) {
        return VipAddrSearchAssociateCell.class;
    };
}

@end
